<template>
	<div>

      <el-dialog title="称重详情单"  width="1300px" @open="open" class="icon-dialog" :visible.sync="show" :before-close="closeForm" append-to-body>
        <el-form ref="form" :model=" stkweightfrom " size="small" label-width="80px" :inline="true" class="header">
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="金蝶单据编号:" class="no-wrap-label" label-width="130px">{{ stkweightfrom.billNo }}</el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="单据类型:" class="no-wrap-label">{{ mappedType }}</el-form-item>

            </el-col>
            <el-col :span="8">
              <el-form-item label="申请日期:" class="no-wrap-label">{{ stkweightfrom.date }}</el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="申请部门:" class="no-wrap-label" label-width="100px">{{ stkweightfrom.departmentName }}</el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="申请人:" class="no-wrap-label">{{ stkweightfrom.user }}</el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="采购订单单据编号:" class="no-wrap-label" label-width="130px">{{ stkweightfrom.purOrderNo }}</el-form-item>
            </el-col>

          </el-row>

          <br />
        </el-form>

        <el-table :data="stkweightList" height="calc(100vh - 300px)">
          <el-table-column label="单据编号" width="160" prop="billNo"></el-table-column>
          <!--        <el-table-column label="No." width="60" align="right" type="index"></el-table-column>-->
          <el-table-column label="物料编码" width="120" prop="materialNo"></el-table-column>
          <el-table-column label="物料名称" width="120" prop="materialName"></el-table-column>
          <el-table-column label="物料规格" width="120" prop="specification"></el-table-column>
          <el-table-column label="单位名称" width="120" prop="basicUnitName"></el-table-column>
          <el-table-column label="单位编码" width="120" prop="basicUnitNo"></el-table-column>
          <!--        <el-table-column label="辅助单位" width="120" prop="unitNumber"></el-table-column>-->
          <el-table-column label="批号" width="120" prop="lot"></el-table-column>
          <el-table-column label="仓库名称" width="120" prop="stockName"></el-table-column>
          <el-table-column label="仓库编码" width="120" prop="stockNo"></el-table-column>
          <el-table-column label="仓位名称" width="120" prop="locationName"></el-table-column>
          <el-table-column label="仓位编码" width="120" prop="locationNo"></el-table-column>
          <el-table-column label="基本单位数量" width="120" prop="basicQty"></el-table-column>
          <el-table-column label="辅助单位名称" width="120" prop="assistantUnitName"></el-table-column>
          <el-table-column label="辅助单位编码" width="120" prop="assistantUnitNo"></el-table-column>
          <el-table-column label="称重数量" width="120" prop="weightQty"></el-table-column>
          <el-table-column label="退料方式" width="120" prop="returnMethod"></el-table-column>

        </el-table>


      </el-dialog>

    </div>
</template>
<script>
import { detail  } from '@/api/app/stkweight'
import stkweight from "@/views/app/stkweight/index.vue";
export default {
	name:'stkweightdetail',
	props: {
		show: {
			type: Boolean,
			default: true
		},
		size: {
			type: String,
			default: 'mini'
		},
		info: {
			type: Object,
		},
	},
	data() {
		return {
			form:{
			},
      stkweightfrom:{},
      stkweightList:[]

		}
	},
  computed: {
    mappedType() {
      switch (this.stkweightfrom.type) {
        case 'A': return '采购退'
        case 'B': return '其他入'
        case 'C': return '其他出'
        default: return '未知类型'  // 兜底逻辑
      }
    }
  },
	watch:{
		show(val){
			if(val){
			}
		}
	},
	methods: {
    stkweight() {
      return stkweight
    },
		open(){
			detail(this.info).then(res => {
        if (res.status == 200) {
          this.stkweightfrom = res.data.data;
          this.stkweightList = res.data.dataList;


        } else {
          this.$message.error('获取详情失败2，请稍后再试');
        }
      }).catch(error => {

        this.$message.error('获取详情失败，请稍后再试');
      });
		},
		closeForm(){
			this.$emit('update:show', false)
		}
	}
}
</script>
<style  lang="scss">
@import '@/assets/scss/common.scss';
.no-wrap-label .el-form-item__label {
  white-space: nowrap; /* 强制不换行 */
}

</style>
